/* Copyright 2014 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * This file has been modified to adapt the component to the needs of Kolibri
 * The original file is available at:
 * https://github.com/mozilla/pdf.js/blob/v2.14.305/web/text_layer_builder.css
 */

.text-layer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  line-height: 1;
  text-align: initial;

  /* Modified: specifiying letter-spacing as normal to avoid kolibri's default letter-spacing
   * misaligning text-layer with the canvas.
   * Original line: 28 */
  letter-spacing: normal;
  opacity: 0.2;
  text-size-adjust: none;

  /* stylelint-disable */
  forced-color-adjust: none;
  /* stylelint-enable */
}

.text-layer span,
.text-layer br {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: text;
  user-select: text;
  transform-origin: 0% 0%;
}

/* Only necessary in Google Chrome, see issue 14205, and most unfortunately
 * the problem doesn't show up in "text" reference tests. */
.text-layer span.markedContent {
  top: 0;
  height: 0;
}

.text-layer .highlight {
  padding: 1px;
  margin: -1px;

  /* TODO Manage with Kolibri standards */
  background-color: rgba(180, 0, 170, 1);
  border-radius: 4px;
}

.text-layer .highlight.appended {
  position: initial;
}

.text-layer .highlight.begin {
  border-radius: 4px 0 0 4px;
}

.text-layer .highlight.end {
  border-radius: 0 4px 4px 0;
}

.text-layer .highlight.middle {
  border-radius: 0;
}

.text-layer .highlight.selected {
  /* TODO Manage with Kolibri standards */
  background-color: rgba(0, 100, 0, 1);
}

.text-layer ::selection {
  /* Modified: selection color.
   * Original line: 74 */

  /* TODO Manage with Kolibri standards */
  background: rgb(0, 168, 255);
}

/* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
.text-layer br::selection {
  background: transparent;
}

.text-layer .endOfContent {
  position: absolute;
  top: 100%;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  display: block;
  cursor: default;
  user-select: none;
}

.text-layer .endOfContent.active {
  top: 0;
}
